perm filename GEOMES.DOC[DOC,BGB] blob sn#054435 filedate 1973-07-25 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00010 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00002 00002	STANFORD ARTIFICIAL INTELLIGENCE LABORATORY  		   MARCH 1973
 00004 00003	BEGIN "TEST1"
 00006 00004	I. FIRST EXPLAINATION - RUNNING GEOMES.
 00010 00005	1st - EUCLIDEAN TRANSFORMATIONS:
 00013 00006	SECOND EXPLAINATION.
 00015 00007	2nd - POLYHEDRON OPERATIONS.
 00016 00008	2nd - EUCLIDEAN TRANSFORMATIONS.
 00017 00009	2nd - IMAGE OPERATIONS.
 00018 00010	NODE ← MKNODE(INTEGER TYP)
 00019 ENDMK
⊗;
STANFORD ARTIFICIAL INTELLIGENCE LABORATORY  		   MARCH 1973
AIM - XX.

draft - draft - draft - draft - draft - draft - draft - draft - draft

           GEOMES  -  GEOMETRIC MODELING EMBEDDED IN SAIL.


                          Bruce g. Baumgart


ABSTRACT:

	This paper explains the SAIL  accessible  subroutine  package
called  GEOMES.    Using  GEOMES,  arbitrary polyhedron models can be
contructed; moved about and viewed in perspective with  hidden  lines
eliminated.   In  addition  to  polyhedra; GEOMES provides models for
cameras and images so that simulators relevant  to  computer  vision,
problem solving, and animation can be constructed.


	FIRST  EXPLAINATION  -
	SECOND EXPLAINATION  - 
	THIRD  EXPLAINATION  -  

		- DATA STRUCTURE.
		- POLYHEDRON OPERATIONS.
		- EUCLIDEAN TRANSFORMATIONS.
		- IMAGE OPERATIONS.
		- EXERCISES.

	SUMMARY GEOMES PRIMITIVES.

	SHORT EXAMPLES.
	EXTENDED EXAMPLES.
		1. Tower Planner.
		2. Insect Walker.
		3. Newton Blocks.
BEGIN "TEST1"
	DEFINE !="COMMENT";
	DEFINE π="3.1415927";
	REQUIRE "⊂⊃⊂⊃" DELIMITERS;
	REQUIRE "GEOMES.HDR" SOURCE_FILE;

	INTEGER B1,B2,F,E,V,V0,T;
	INTEGER WORLD,WINDOW,CAMERA;

! UNIVERSE CREATION;

	WORLD ← MKWORLD;	! MAKE A WORLD;
	WINDOW ← MKWINDOW;	! MAKE A WINDOW;
	CAMERA ← MKCAMERA;	! MAKE A CAMERA;
	BATT(WORLD,WINDOW);	! BODY-ATTACH WORLD TO WINDOW;
	BATT(CAMERA,WINDOW);	! BODY-ATTACH CAMERA TO WINDOW;
	
! BODY CREATION;
	
	B1 ← MKCUBE(4.0,1.0,2.0);      ! MAKE RECTANGULAR PRISM;
	B2 ← MKCOPY(B1);	       ! COPY THE PRISM;

! ACTION;

	FOR T←1 STEP 1 UNTIL 30 DO
		 OUTSTR(13&10);		! FLUSH THE PAGE PRINTER;
	TRANSLATE(B1,0,0,4);		! 4 FEET +Z TOWARDS CAMERA;
	ROTATE(B2,π/8,π/8,0);		! ROTATION ABOUT X & Y AXES;
	WHILE TRUE DO 
	BEGIN
		ROTATE(B1,0,-π/17,0);	! ROTATION CW ABOUT Y-AXIS;
	FOR T←1 STEP 1 UNTIL 40 DO
	BEGIN 
		ROTATE(B1,π/20,0,0);	! ROTATION CCW ABOUT X-AXIS;
		ROTATE(B2,0,π/16,0);	! ROTATION CCW ABOUT Y-AXIS;
		SHOW2(WINDOW,1);	! DISPLAY A SIMULATED IMAGE;
		IF INCHRS≥1 THEN DONE;	! EXIT ON TYPE-ANY-KEY;
	END;
	END;

END "TEST1"; BGB 19 MARCH 1973.
I. FIRST EXPLAINATION - RUNNING GEOMES.

	This first  explaination  presents  a  small  and  restricted
subset of GEOMES for construction and animation using bricks.  Please
now read the example program,  TEST1.   In  the  example,  GEOMES  is
declared by requiring the source file GEOMES.HDR[SAI,BGB] under horse
shoe delimiters.  When  executed,  TEST1  displays  one  cubic  brick
tumbling around another.


1st - DATA STRUCTURE:

	GEOMES has a representation for the  things  called  "world",
"window",  "camera" and "body"; such things are always referred to by
an integer pointer. A world is a set of bodies; a camera is a  camera
model; a window ties pairs of cameras and worlds together; and a body
is a model of a polyhedron composed of faces, edges and vertices. The
only kind of body available is a rectangular right prism. To get your
data structure initialized, write the following instructions:

	WORLD ← MKWORLD;		make world.
	WINDOW ← MKWINDOW;		make window.
	CAMERA ← MKCAMERA;		make camera.
	BATT(WORLD,WINDOW);		
	BATT(CAMERA,WINDOW);
	
	
1st - POLYHEDRON OPERATIONS:
	
	BODY ← MKCUBE(XSIDE,YSIDE,ZSIDE);	make cubic solid.
	BODY ← MKCOPY(BODY);			make a copy.
	
	The  routine  MKBODY generates a rectangular right prism with
sides of length XSIDE, YSIDE and ZSIDE. The center of  the  prism  is
initially  at  the  world  origin,  (0,0,0).   The arguments are real
numbers representing feet. The initial camera is located sixteen feet
above  the X-Y plane and is looking down with a 12.5 millimeter lens,
which means that any block with sides less than 20 feet  will  be  in
view.  The routine MKCOPY will return a copy of its argument, the new
body will have the same location and orientation as the old one,  and
should be moved before a hidden line elimination.

	WHOLE ← BATT(PART,WHOLE);	body attach.
	PART  ← BDET(PART);		body detach.

	The BATT routine attachs one body to  another  so  that  when
something  is  moved  or copied all its parts will be moved or copied
too. Naturally, parts may have subparts and so on. A  body  is  freed
from its role as a part of something by the BDET routine.
1st - EUCLIDEAN TRANSFORMATIONS:

	TRANSLATE(OBJECT,DELTAX,DELTAY,DELTAZ);
	ROTATE(OBJECT,ABOUTX,ABOUTY,ABOUTZ);

	The   TRANSLATE  routine  takes  four  arguments,  the  first
argument is the integer pointing at the thing to be  translated,  the
next  three  arguments  are real numbers indicating a displacement in
feet parallel to the X, Y and Z world axes respectively.   The  world
frame of reference is right handed and orthogonal.

	The  ROTATE  routine takes four arguments, the first argument
is the integer pointing at the thing to  be  rotated,  and  the  next
three arguments are real numbers indicating a angular displacement in
radians about the X, Y and Z world axes  respectively.  The  positive
direction  of  rotation  is  counterclockwise; which is the so called
right hand rule convention.


1st - IMAGE OPERATIONS:

	INTEGER PROCEDURE SHOW1 (INTEGER WINDOW,GLASS);
	INTEGER PROCEDURE SHOW2 (INTEGER WINDOW,GLASS);

	There are two simple display  operations:  SHOW1  and  SHOW2.
The SHOW1 routine displays all the edges appearing in the window. The
SHOW2 routine performs a hidden line elimination  and  displays  only
the portions of edges that are not occultated. Both routines take two
arguments, the first argument is the window to be displayed  and  the
second  argument is the number, 0 to 15, of the III piece of glass to
which the display buffer is sent.


1st - EXERCISES:

1. Make the tower shown in the figure using 1,2,4 bricks.
2. Make a table with four chairs. (use the BATT and MKCOPY).
3. Make a simulation of a small bouncing cube.
SECOND EXPLAINATION.

2nd - DATA STRUCTURE.

	The GEOMES data  structure  is  implemented  as  twelve  word
blocks  containing pointers and data in the fashion usual to graphics
and simulation; an introduction to this technology can  be  found  in
Knuth.    The  language of implementation is PDP-10 machine code, and
although the data and subroutines discussed below are accessible from
SAIL,  with  the  exception of CORGET, no SAIL routines are called by
GEOMES routines. In particular, GEOMES emphatically has nothing to do
with LEAP.

	The  twelve  word  blocks of GEOMES are called "nodes". Nodes
are referred to by their actual machine  address  in  the  user  core
image, which is an integer called a "link". Thus the subroutines that
take nodes as arguments or return nodes as values pass  links  rather
than  the  nodes  themselves.   In  SAIL,  the user core image can be
accessed as a special array named MEMORY. Using the MEMORY feature of
SAIL,  the  GEOMES.HDR  defines  names  for  where links and data are
stored relative to the origin of a node.

2nd - POLYHEDRON OPERATIONS.
2nd - EUCLIDEAN TRANSFORMATIONS.
2nd - IMAGE OPERATIONS.
NODE ← MKNODE(INTEGER TYP);
NIL  ← KLNODE(INTEGER NODE);

WORLD ← MKWORLD;
WINDOW ← MKWINDOW;
CAMERA ← MKCAMERA;
LO ← MKLOCOR;

B ← MKB(WORLD);
NIL ← KLB(WORLD);
NIL ← KLBFEV(WORLD);

F ← MKF(B);
E ← MKE(B);
V ← MKV(B);

NIL ← WING(E1,E2);
BOOL ← LINKED(Q1,Q2);

E ← ECW(FEV,FEV);
E ← ECCW(FEV,FEV);
FV ← OTHER(E,FV);